package controller;

import model.*;

import java.sql.Connection;

public class AdminController {
    public static void main(String[] args) {
        try (Connection connection = DatabaseConnection.getConnection()) {
            // 按日期统计
            SalesStrategy dateStrategy = new DateSalesStrategy("2024-12-21");
            System.out.println("Sales on 2024-12-21: $" + dateStrategy.calculateSalesFromDB(connection));

            // 按商品类型统计
            SalesStrategy typeStrategy = new TypeSalesStrategy("Pizza");
            System.out.println("Sales for Pizza: $" + typeStrategy.calculateSalesFromDB(connection));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
